// ************************************
// ZS_Sitaround / ZS_Deal
// ************************************

func void ZS_Sitaround () {
	Perception_Set_Normal();
	B_ResetAll (self);
	AI_SetWalkmode (self, NPC_WALK);
	if (Npc_GetDistToWP (self,self.wp) > TA_DIST_SELFWP_MAX) {
		AI_GotoWP (self, self.wp);
	};
	if (!Npc_IsOnFP(self, "SITAROUND")){
		if(Wld_IsFPAvailable(self,"SITAROUND")) {
			AI_GotoFP 		(self, "SITAROUND");
			AI_AlignToFP 	(self);
		};
	};
	AI_PlayAni		(self, "T_STAND_2_SIT");
	AI_LookAtNpc(self, hero);
};
func int ZS_SitAround_Loop () {
	AI_Wait(self,4);
};
func void ZS_Sitaround_End() {
	AI_PlayAni		(self, "T_SIT_2_STAND");
};

func void ZS_Deal ()
{
	Perception_Set_Normal();
	B_ResetAll (self);
	AI_SetWalkmode (self, NPC_WALK);
	if (Npc_GetDistToWP (self,self.wp) > TA_DIST_SELFWP_MAX) {
		AI_GotoWP (self, self.wp);
	};
	if (Npc_HasItems (self,ItMi_Joint) == 0) {
		CreateInvItem (self,ItMi_Joint);				
	};
	AI_UseItemToState (self,ItMi_JOINT,0);
	AI_PlayAni (self, "T_JOINT_RANDOM_1");
	AI_PlayAni (self, "T_STAND_2_HGUARD");
};

func int ZS_Deal_Loop () {
	if (!Npc_IsOnFP(self, "DEAL")){
		if(Wld_IsFPAvailable(self,"DEAL")) {
			AI_PlayAni (self, "T_HGUARD_2_STAND");
			AI_GotoFP 		(self, "DEAL");
			AI_AlignToFP 	(self);
			AI_PlayAni (self, "T_STAND_2_HGUARD");
		};
	};
	AI_Wait(self,4);
	
	if(!Hlp_Random(3)) {
		AI_PlayAni (self, "T_HGUARD_2_STAND");
		AI_PlayAni (self, "T_JOINT_RANDOM_1");
		AI_PlayAni (self, "T_STAND_2_HGUARD");
	};
};

func int ZS_Deal_End () {
	AI_PlayAni		(self, "T_LGUARD_2_STAND");
	AI_UseItemToState (self, ItMi_Joint, -1);
};